//JavaScript Framework 2.0 Code
try {
	Type.registerNamespace('com.yonyou.ncmm_pac_pda.PuInTestController');
	com.yonyou.ncmm_pac_pda.PuInTestController = function() {
		com.yonyou.ncmm_pac_pda.PuInTestController.initializeBase(this);
		this.initialize();
	}

	function com$yonyou$ncmm_pac_pda$PuInTestController$initialize() {
		//you can programing by $ctx API
		//get the context data through $ctx.get()
		//set the context data through $ctx.push(json)
		//set the field of the context through $ctx.put(fieldName, fieldValue)
		//get the parameter of the context through $ctx.param(parameterName)
		//Demo Code:
		//    var str = $ctx.getString();      //获取当前Context对应的字符串
		//    alert($ctx.getString())          //alert当前Context对应的字符串
		//    var json = $ctx.getJSONObject(); //获取当前Context，返回值为json
		//    json["x"] = "a";        //为当前json增加字段
		//    json["y"] = [];           //为当前json增加数组
		//    $ctx.push(json);            //设置context，并自动调用数据绑定
		//    
		//    put方法需手动调用databind()
		//    var x = $ctx.get("x");    //获取x字段值
		//    $ctx.put("x", "b");     //设置x字段值
		//    $ctx.put("x", "b");     //设置x字段值
		//    $ctx.databind();            //调用数据绑定才能将修改的字段绑定到控件上
		//    var p1 = $param.getString("p1");   //获取参数p2的值，返回一个字符串
		//    var p2 = $param.getJSONObject("p2");   //获取参数p3的值，返回一个JSON对象
		//    var p3 = $param.getJSONArray("p3");   //获取参数p1的值，返回一个数组

		//your initialize code below...

	}

	function com$yonyou$ncmm_pac_pda$PuInTestController$evaljs(js) {
		eval(js)
	}

	function com$yonyou$ncmm_pac_pda$PuInTestController$button0_onclick(sender, args) {
		var text = $id("textbox0").get("value");
		var twocodepath = $scanner.generateQRCode({
			size: "100", //二维码正方形的宽高
			content: text //生成二维码所需的源文字
		});
		$id("image0").set("src", twocodepath);
	}


function showPanel1(sender, args){
    $id("panel1").set("visible","true");
   

}
function panel1Hide(sender, args){
          var list=[];
          for(var i=0;i<=20;i++)
          {
            var json={"code":i,"name":"商品"+i,"price":10*i};
            list.push(json);
          }
          var json = {
                   list : list
          };
          $ctx.push(json);
}
function changeBg(sender, args){
//1 获取list值
//2 循环初始化如果color不为空，则取出
var panel2= $id("panel2");
var checkbox=$find("checkbox0",panel2);
$alert("checkbox"+$jsonToString({"checkbox":checkbox}));
  
}
function showInfo(sender, args){
    $alert("args="+$jsonToString(args));

}

	com.yonyou.ncmm_pac_pda.PuInTestController.prototype = {
		button0_onclick: com$yonyou$ncmm_pac_pda$PuInTestController$button0_onclick,
		initialize: com$yonyou$ncmm_pac_pda$PuInTestController$initialize,
		evaljs: com$yonyou$ncmm_pac_pda$PuInTestController$evaljs
	};
	com.yonyou.ncmm_pac_pda.PuInTestController.registerClass('com.yonyou.ncmm_pac_pda.PuInTestController', UMP.UI.Mvc.Controller);
} catch(e) {
	$e(e);
}